import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { GrowInfoVO, GrowInfoForm, GrowInfoQuery } from '@/api/farm/chicken/growInfo/types';

/**
 * 查询成长记录列表
 * @param query
 * @returns {*}
 */

export const listGrowInfo = (query?: GrowInfoQuery): AxiosPromise<GrowInfoVO[]> => {
  return request({
    url: '/farm/chicken/growInfo/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询成长记录详细
 * @param id
 */
export const getGrowInfo = (id: string | number): AxiosPromise<GrowInfoVO> => {
  return request({
    url: '/farm/chicken/growInfo/' + id,
    method: 'get'
  });
};

/**
 * 新增成长记录
 * @param data
 */
export const addGrowInfo = (data: GrowInfoForm) => {
  return request({
    url: '/farm/chicken/growInfo',
    method: 'post',
    data: data
  });
};

/**
 * 修改成长记录
 * @param data
 */
export const updateGrowInfo = (data: GrowInfoForm) => {
  return request({
    url: '/farm/chicken/growInfo',
    method: 'put',
    data: data
  });
};

/**
 * 删除成长记录
 * @param id
 */
export const delGrowInfo = (id: string | number | Array<string | number>) => {
  return request({
    url: '/farm/chicken/growInfo/' + id,
    method: 'delete'
  });
};
